package com.telecom.service.Impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dahuatech.hutool.http.Method;
import com.dahuatech.hutool.json.JSONUtil;
import com.dahuatech.icc.exception.ClientException;
import com.dahuatech.icc.oauth.model.v202010.GeneralResponse;
import com.telecom.common.HttpsUtils;
import com.telecom.domain.AcPgUserConf;
import com.telecom.domain.dto.AcPgUserConfDTO;
import com.telecom.service.AcPgUserConfService;
import com.telecom.mapper.AcPgUserConfMapper;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
* @author 李毅
* @description 针对表【ac_pg_user_conf(权限组人员配置表)】的数据库操作Service实现
* @createDate 2023-04-08 16:01:53
*/
@Service
public class AcPgUserConfServiceImpl extends ServiceImpl<AcPgUserConfMapper, AcPgUserConf>
    implements AcPgUserConfService{

    @Override
    public void doorAuthority(AcPgUserConfDTO acPgUserConfDTO) throws ClientException {
        String s = JSONUtil.toJsonStr(acPgUserConfDTO);
        Map<String,Object> map = JSONObject.parseObject(s, HashMap.class);
        System.out.println("requestMap = " + map);
        GeneralResponse generalResponse = HttpsUtils.iRequest("/evo-apigw/evo-accesscontrol/1.0.0/card/accessControl/doorAuthority", Method.POST, map);
        Map<String,Object> resultMap = JSONObject.parseObject(generalResponse.getResult(),HashMap.class);
        System.out.println("resultMap = " + resultMap);
    }
}




